package cn.lin.controller;

import cn.lin.service.UserService;
import cn.lin.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author qmp
 * @date 2024/12/3 9:58
 */
@RestController
@RequestMapping("/excel")
public class ExcelUploadController {

    @Autowired
    private UserService userService ;

    @PostMapping("/upload")
    public Object upload(@RequestParam("file") MultipartFile file, @RequestParam("organizationId") int organizationId){
        return userService.importTprkxx(file,organizationId).get("state").equals(200) ? Result.ok("导入成功") : Result.error("导入失败") ;
    }

}
